package com.mezz.bones.im.common.result;

import com.mezz.bones.im.common.exception.ImBaseException;

/**
 * @Author: zhuang
 * @Date: 2024/12/12 15:10
 * @Description: TODO
 * @Version: 1.0
 **/

public enum ImResultCode {

    /**
     * S错误码 - 系统错误
     */
    SUCCESS("200", "success"),
    SYS_ERROR("30000","系统错误!"),


    TIME_ZONE_ERROR("30001","时区错误!"),

    //参数异常
    PARAM_ERROR("300009","参数异常"),

    TRY_LOCK_ERROR("300010","系统繁忙,请稍后再试!"),

    //非法操作
    ILLEGAL_OPERATION("300011","非法操作!"),

    USER_NOT_LOGIN("400001","用户未登录"),
    USER_TOKEN_ERROR("400002","Token异常"),


    USER_SIGN_ERROR("400003","Sign签名异常"),

    DATA_NOT_FOUND("400004","业务数据不存在!"),
    USER_STATUS_ERROR("400005","用户状态异常"),

    USER_MUTED ("400006","用户被禁言"),

    ;


    private String code;
    private String message;

    public static ImResultCode findEnums(String code){
        for (ImResultCode value : ImResultCode.values()) {
            if(value.getCode().equals(code)){
                return value;
            }
        }
        throw new ImBaseException("ImResultCode no enums :{}", code);
    }

    ImResultCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
